
/**
 *  \file sdp_internal.h
 *
 *  Internal header file for SDP.
 */

/*
 *  Copyright (C) 2013. Mindtree Ltd.
 *  All rights reserved.
 */

#ifndef _H_SDP_INTERNAL_
#define _H_SDP_INTERNAL_

/* -------------------------------- Header File Inclusion */
#include "BT_common.h"
#include "BT_bottom_half.h"
#include "BT_sdp_api.h"
#include "BT_dbase_api.h"

#include "sdp.h"
#include "l2cap.h"


/* -------------------------------- SDP Debug */
#ifndef SDP_NO_DEBUG
#define SDP_ERR(...)         BT_debug_error(BT_MODULE_ID_SDP, __VA_ARGS__)
#else  /* SDP_NO_DEBUG */
#define SDP_ERR              BT_debug_null
#endif /* SDP_NO_DEBUG */

#ifdef SDP_DEBUG

#define SDP_TRC(...)          BT_debug_trace(BT_MODULE_ID_SDP, __VA_ARGS__)
#define SDP_INF(...)          BT_debug_info(BT_MODULE_ID_SDP, __VA_ARGS__)
#define SDP_debug_dump_bytes(data, datalen) BT_debug_dump_bytes(BT_MODULE_ID_SDP, (data), (datalen))

#else  /* SDP_DEBUG */

#define SDP_TRC               BT_debug_null
#define SDP_INF               BT_debug_null
#define SDP_debug_dump_bytes(data, datalen)

#endif /* SDP_DEBUG */


/* -------------------------------- Global Definitions */
/**
 *  Return Value used by the PDU Handler (PDUH) to indicate the Client
 *  Handler (CH) that another request has send for the received
 *  Partial Response (PR).
 *
 *  This is a return value used inside the SDP functions.
 */
#define SDP_SEND_REQ_PARTIAL_RSP        (SDP_ERR_ID | 0x00FE)

/** Abstarction for malloc & free */
#define sdp_malloc                      BT_alloc_mem
#define sdp_free                        BT_free_mem

/** Locking & Unlocking SDP Mutex */
#define sdp_lock()                      BT_MUTEX_LOCK(sdp_mutex, SDP)
#define sdp_unlock()                    BT_MUTEX_UNLOCK(sdp_mutex, SDP)
#define sdp_lock_void()                 BT_MUTEX_LOCK_VOID(sdp_mutex, SDP)
#define sdp_unlock_void()               BT_MUTEX_UNLOCK_VOID(sdp_mutex, SDP)


/*
 * The following bytes related definitions are used by the PDU handler
 * for framing and parsing the packets and data elements
 */

/** Maximum 1/2/4 byte value */
#define SDP_ONE_BYTE_MAX                0xFF
#define SDP_TWO_BYTE_MAX                0xFFFF
#define SDP_FOUR_BYTE_MAX               0xFFFFFFFF

/** One/Two/Four Byte data length */
#define SDP_ONE_BYTE                    1
#define SDP_TWO_BYTE                    2
#define SDP_FOUR_BYTE                   4


/* Masks used to extact the nibble for processing data elements */

/** Upper/Lower nibble mask for one byte value */
#define SDP_UPPER_NIBBLE_MASK           0xF0
#define SDP_LOWER_NIBBLE_MASK           0x0F

/** Upper/Lower 2 byte mask for 4 byte value */
#define SDP_UPPER_2BYTE_MASK            0xFFFF0000
#define SDP_LOWER_2BYTE_MASK            0x0000FFFF

/** Data Element header mask */
#define        SDP_DE_HEAD_MASK         0x07
/** One byte index value */
#define        SDP_ONE_BYTE_INDEX       5
/** 2 byte index value */
#define        SDP_TWO_BYTE_INDEX       6
/** Four byte index value */
#define        SDP_FOUR_BYTE_INDEX      7
/** Data element NULL */
#define        SDP_DE_NULL              0x0
/** Data Element type header for unsigned Integer */
#define        SDP_DE_UNSIGN_INT        0x1
/** Data Element type header for sign integer */
#define        SDP_DE_SIGN_INT          0x2
/** Data Element type header for UUID */
#define        SDP_DE_UUID              0x3
/** Data Element type header for string */
#define        SDP_DE_STRING            0x4
/** Data Element type header for Boolean */
#define        SDP_DE_BOOL              0x5
/** Data Element type header for Data Sequence */
#define        SDP_DE_SEQUENCE          0x6
/** Data Element type header for Data alternative */
#define        SDP_DE_ALTERNATIVE       0x7
/** Data Element type header for URL */
#define        SDP_DE_URL               0x8
/** Data Element type header reserved */
#define        SDP_DE_RESERVED          0x9

/** Attribute ID size */
#define        SDP_ATTR_ID_TYPE         0x2
/** Attribute Range size */
#define        SDP_ATTR_RANGE_TYPE      0x4

/** Length of error parameters */
#define SDP_ERR_PARAM_LEN               0x0002

/* Minimum Length Required for SDP PDU */
#define SDP_PDU_HEADER_LENGTH           5

/* Length for Contiuation state information */
#define SDP_CONT_STATE_INFO_LEN         16

/*
 * The following identifiers are used by the SDP to identify the role of
 * the entities(data/code) and its validity. Type field of SDP Connection
 * Entity (SDP_CE) structure accept one of this values only.
 */
/** SDP CE: Server/Client/Unallocated */
#define SDP_SERVER_TYPE                 0x02
#define SDP_CLIENT_TYPE                 0x01
#define SDP_INVALID                     0x00
#define SDP_PROCESSING_PARTIAL_RSP      0x03

/* Identifier to mark SDP No Continuation Information */
#define SDP_NO_CONT_INFO                0x00


/*
 * SDP connection entity maintains the connection status information.
 * Each bits in the one byte status has the following meanings.
 *
 * |-----------------------------------------------------------------------|
 * |   7    |    6   |   5    |   4    |   3    |   2    |   1    |   0    |
 * |-----------------------------------------------------------------------|
 *     |        |        |        |        |        |        |        |
 *     |        |        |        |        |        |        |        |
 * SDP_CONNECTED|        |        |        |        |        |        |
 *   SDP_IN_DISCONNECTION|        |        |        |        |        |
 *           SDP_L2CAP_CONNECTED  |        |        |        |        |
 *                 SDP_IN_L2CAP_CONNECT    |        |        |        |
 *                             SDP_L2CAP_IN_CONFIG  |        |        |
 *                              SDP_L2CAP_CONFIG_SELF_STARTED|        |
 *                                               SDP_L2CAP_CONFIG_SELF|
 *                                                    SDP_L2CAP_CONFIG_PEER
 *
 * The following definitions indicates the connection status in SDP
 *
 */
/** SDP is disconnected */
#define SDP_DISCONNECTED                0x00

/** SDP state is in L2CAP connect */
#define SDP_L2CAP_IN_CONNECT            0x10

/** L2CAP channel is established for SDP */
#define SDP_L2CAP_CONNECTED             0x20

/** SDP state is in Disconnection */
#define SDP_IN_DISCONNECTION            0x40

/** SDP is connected */
#define SDP_CONNECTED                   0x80

/** SDP L2CAP Channel unconfigured*/
#define SDP_L2CAP_NO_CONFIG             0x00

/** SDP state is in L2CAP configuration */
#define SDP_L2CAP_IN_CONFIG             0x08

/** L2CAP channel Configuration completed for peer */
#define SDP_L2CAP_CONFIG_PEER           0x09

/** Self L2CAP channel configuration completed */
#define SDP_L2CAP_CONFIG_SELF           0x0A

/** L2CAP channel configuration completed for peer and self */
#define SDP_L2CAP_CONFIG_BOTH           0x0B

/** L2CAP channel self configuration started */
#define SDP_L2CAP_CONFIG_SELF_STARTED   0x0C

/*
 * The following definitions indicates the state/events used for the
 * SDP transactions
 */
/** SDP Client state: Client is waiting for the response */
#define SDP_RSP_WAIT                    0x01

/** SDP Server  state: Server received a request */
#define SDP_REQ_RECV                    0x02

/** SDP Server state  - Server send a partial response */
#define SDP_PART_RSP_SEND               0x10

/** SDP Client state - Client received a partial response */
#define SDP_PART_RSP_RECV               0x20



/* --------------------------------------- Macros */
/**
 * Extract one byte attribute value from the attribute data .
 * it calls the sdp_get_int_attributes_value() with a requested size of 1.
 */
#define sdp_get_UCHAR_attribute_value(x,y,z) \
        sdp_get_int_attribute_value(x,y,z,1)

/* Macros for convert to byte order */
#define sdp_convert_from_UINT16(buffer,data) \
        { \
            (*((buffer)+1)) = (UCHAR)(data); \
            (*((buffer)+0)) = (UCHAR)((data) >> 8); \
        }

#define sdp_convert_from_UINT32(buffer,data) \
        { \
            (*((buffer)+3)) = (UCHAR)(data); \
            (*((buffer)+2)) = (UCHAR)((data) >> 8); \
            (*((buffer)+1)) = (UCHAR)((data) >> 16); \
            (*((buffer)+0)) = (UCHAR)((data) >> 24); \
        }

#define sdp_convert_to_UINT16(data, buffer) \
        {                                   \
            data = *((buffer)+0);           \
            data <<= 8;                     \
            data |= (*((buffer)+1));        \
        }

#define sdp_convert_to_UINT32(data, buffer) \
        {                                   \
            data = *((buffer)+0);           \
            data <<= 8;                     \
            data |= (*((buffer)+1));        \
            data <<= 8;                     \
            data |= (*((buffer)+2));        \
            data <<= 8;                     \
            data |= (*((buffer)+3));        \
        }

#ifdef SDP_SERVER
#ifdef SDP_SERVER_HAVE_CB_IND_SUPPORT
#define SDP_SERVER_IND_CB(event_type, event_data, event_datalen)            \
        sdp_unlock();                                                       \
        if (NULL != sdp_server_ind_cb)                                      \
        {                                                                   \
            SDP_TRC (                                                       \
            "[SDP SERVER] Calling Callback. Event Type 0x%02X, "            \
            "Peer BD_ADDR %02X:%02X:%02X:%02X:%02X:%02X\n",                 \
            (event_type), (event_data)[0], (event_data)[1], (event_data)[2],\
            (event_data)[3], (event_data)[4], (event_data)[5]);             \
                                                                            \
            sdp_server_ind_cb((event_type), (event_data), (event_datalen)); \
        }                                                                   \
        sdp_lock();
#endif /* SDP_SERVER_HAVE_CB_IND_SUPPORT */
#endif /* SDP_SERVER */

/* -------------------------------- Data Type/Structures/Typedefs */
/** SDP PDU structure */
typedef struct
{
    /**
     *  The buffer used to store the byte stream.
     *  Size of this buffer  will be SDP_DEFAULT_L2CAP_MTU + 21
     *  (continuation state length + L2CAP_HDR_LEN).
     */
    UCHAR * packet;

    /**
     *  Length of the PDU. This can also be the offset in the
     *  packet to access the PDU values
     */
    UINT16  pdu_length;

   /*
    *  Balance length in the packet that can be used to
    *  frame the PDU or Data Element Sequence
    */
    UINT16  pdu_space;

} SDP_PDU;


/**
 *  Connection entities are used by the SDP server and client to track the
 *  SDP connection between the devices. A device can have a maximum of one
 *  client entity per remote device. There is no specific limitation for the
 *  number of entities for the server.
 */
typedef struct
{
    /**
     *  At the client side this holds the request to be transmitted
     *  or already transmitted request (to handle partial responses).
     *
     *  At server side this is used to frame the reponse for the request.
     */
    SDP_PDU pdu;

    /** Transcation ID used for current transaction */
    UINT16 transaction_id;

    /** The negotiated number of bytes SDP can send through the L2CAP */
    UINT16 out_mtu;

    /** L2CAP Channel Identifier */
    UINT16 cid;

    /**
     *  Type of the connection entity.
     *  The valid value are SDP_CLIENT_TYPE or SDP_SERVER_TYPE.
     */
    UCHAR type;

    /**
     *  Connection status of the SDP. the least significat nibble is
     *  used for configuration and the most significant nibble for
     *  L2CAP channel status.
     */
    UCHAR state;

    /** Remote Device Context */
    DEVICE_HANDLE   device_handle;

} SDP_CE;


#ifdef SDP_CLIENT

/**
 *  This is required for the SDP client. This entity is used to
 *  store the information of the caller (Informations available with
 *  the user thread that calls the API). It is allowed to permitt only
 *  one outstanding context with the same BD Address
 */
typedef struct
{
    /**
     *  uarea stores the pointer of the out parameters to return.
     *  It may be the handles or attribute data
     */
    void * u_area;

    /** result of the Transaction */
    API_RESULT result;

    /**
     *  Length of handles/attribute data requested. This value will
     *  return back to the caller of the API on success, indicates the
     *  number of handles received in SDP service search or number of
     *  attribute bytes received in attribute transactions
     */
    UINT16 num_handles_or_attr;

    /**
     *  This indicates the available buffer space for storing the results
     *  of service transactions. It indicates the buffer size for storing the
     *  handles or attribute data. SDP decrement this value according to the
     *  data received in the (partial)response.
     */
    UINT16 valid_buffer_size;

    /** Current API request  */
    UCHAR request;

    /** Context is valid or not */
    UCHAR valid;

    /** SDP Handle */
    SDP_HANDLE handle;

    DEVICE_HANDLE    device_handle;

    UCHAR                  ce_index;

} SDP_USER_CONTEXT;

#endif /* SDP_CLIENT */


#ifdef SDP_CLIENT
/* --------------- SDP Bottom Half Structures */
/**
 *  Bottom Half input parameters for the Service Search Request.
 *  APIs form this structure and enqueue it with the BH Handler to
 *  process the request.
 */
typedef struct
{
    /** UUIDs for Service Search Pattern */
    S_UUID uuids [SDP_CLIENT_MAX_NUM_UUIDS];

    /** Number of UUIDS in "uuids" */
    UINT16 num_uuids;

    /** Maximum number of record handles requesting */
    UINT16 max_handles;

} SDP_SSR_PARAMS;


/**
 *  Bottom Half input parameters for the Service Attribute Request.
 *  APIs form this structure and enqueue it with the BH Handler to
 *  process the request.
 */
typedef struct
{
    /** Attribute IDs for Attribute ID list of the Service Attribute Request */
    UINT16 attribute_ids[SDP_MAX_ATTR_ID];

    /** Number of Attribute IDs in the "attribute_ids" list */
    UINT16 num_attribute_ids;

    /** Attribute range for the Attribute ID list of the request */
    UINT32 attribute_id_range[SDP_MAX_ATTR_RANGE];

    /** Number of Attribute ranges in the "attribute_id_range" list */
    UINT16 num_attribute_id_range;

    /** Maximum number of attributes requested as response */
    UINT16 max_attribute_byte_count;

    /** Record Handles received from the previous service search request */
    UINT32 handle;

} SDP_SAR_PARAMS;


/**
 *  Bottom Half input parameters for the Service Search Attribute Request.
 *  APIs form this structure and enqueue it with the BH Handler to
 *  process the request.
 */
typedef struct
{
    /** Number of UUIDS in "uuids" */
    UINT16 num_uuids;

    /** UUIDs for Service Search Pattern*/
    S_UUID uuids [SDP_CLIENT_MAX_NUM_UUIDS];

    /**
     * Attribute IDs for the Attribute ID list of the
     * Service Attribute Request.
     */
    UINT16 attribute_ids [SDP_MAX_ATTR_ID];

    /** Number of Attribute IDs in the "attribute_ids" list. */
    UINT16 num_attribute_ids;

    /** Attribute range for the Attribute ID list of the  request */
    UINT32 attribute_id_range [SDP_MAX_ATTR_RANGE];

    /** Number of Attribute ranges in the "attribute_id_range" list */
    UINT16 num_attribute_id_range;

    /** Maximum number of attributes requested as response  */
    UINT16 max_attribute_byte_count;

} SDP_SSAR_PARAMS;


typedef union
{
    /* Service Search Parameters */
    SDP_SSR_PARAMS ssr_params;

    /* Service Attribute Parameters */
    SDP_SAR_PARAMS sar_params;

    /* Serviec Search Attribute Parameters */
    SDP_SSAR_PARAMS ssar_params;

} SDP_REQUEST_PARAMS;

typedef struct
{
    UCHAR                 user_context;

    SDP_REQUEST_PARAMS    api_param;

}SDP_API_REQUEST_PARAMS;

#endif /* SDP_CLIENT */


/* -------------------------------- Function Declarations */
/* -------- Utils */
void sdp_util_ce_reset
     (
         /* IN */   SDP_CE *entity
     );

/*
 * function to find the connection entity using the L2CAP
 * Connection Identifier.
 */
API_RESULT sdp_util_ce_find_cid
           (
               /* IN */    UINT16      /* L2CAP CID */,
               /* OUT */   SDP_CE**    /* Connection Entity */
           );

/*
 * Function to check the state of the connection entity and update the
 * state according to the received event.
 */
API_RESULT sdp_util_ce_set_state
           (
               /* IN */    SDP_CE*   /* entity */,
               /* IN */    UCHAR     /* event */
           );


/* -------- SDP Transport */
/* Registered callback function with L2CAP for Connect indication */
API_RESULT sdp_l2cap_connect_ind
           (
               /* IN */ DEVICE_HANDLE    * handle,    /* Device Handle */
               /* IN */ UINT16             lcid,      /* CID */
               /* IN */ UINT16             psm        /* PSM Value for SDP */
           );

/*
 * Registered callback function with the l2cap for the SDP Client
 * to receive the connect confornation for the L2CAP connect
 * Request
 */
API_RESULT sdp_l2cap_connect_cfm
           (
               /* IN */ DEVICE_HANDLE    * handle,    /* Device Handle */
               /* IN */ UINT16             lcid,      /* CID */
               /* IN */ UINT16             result,    /* Result */
               /* IN */ UINT16             status     /* Status */
           );

/*
 * Registered callback function with L2CAP to receive the Disconnect
 * Request for the L2CAP Channel
 */
API_RESULT sdp_l2cap_disconnect_ind
           (
               /* IN */    UINT16       /* CID */
           );

/*
 * Registered callback function with L2CAP to receive the conformation for
 * the disconnection of L2CAP channel
 */
API_RESULT sdp_l2cap_disconnect_cfm
           (
               /* IN */    UINT16       /* CID */,
               /* IN */    UINT16       /* result */
           );

/*
 * Registered callback function to receive the indication for the
 * incoming configuration request
 */
API_RESULT sdp_l2cap_config_ind
           (
               /* IN */    UINT16       /* CID */,
               /* IN */    L2CAP_CONFIG_OPTION *  /* Config Options */
           );

/*
 * Registered callback function with L2CAP to receive the conformation
 * for the configuration complete of L2CAP Channel
 */
API_RESULT sdp_l2cap_config_cfm
           (
               /* IN */    UINT16       /* CID */,
               /* IN */    UINT16       /* Result */,
               /* IN */    L2CAP_CONFIG_OPTION *  /* Config Options */
           );

/** Registered callback function with L2CAP to receive the data packet */
API_RESULT sdp_l2cap_read
           (
               /* IN */    UINT16        /* CID */,
               /* IN */    UCHAR*        /*  data */,
               /* IN */    UINT16        /* data length */
           );

API_RESULT sdp_l2cap_send
           (
               /* IN */   SDP_CE* /*entity*/
           );



/* ---------- SDP PDU Handler */
API_RESULT sdp_pdu_handler_frame_data_element_sequence
           (
               /* IN */    UCHAR         /* type */ ,
               /* INOUT */ SDP_PDU*       /* pdu */,
               /* IN */    void*         /* data */,
               /* IN */    UINT16        /* no_of_elements */
           );

API_RESULT sdp_pdu_handler_parse_data_element
           (
               /* INOUT */ UCHAR**       /* pdu */,
               /* INOUT */ UINT16*       /* length */,
               /* OUT */   UCHAR*        /* type */,
               /* OUT */   UINT32*       /* Data element length */
           );

API_RESULT sdp_pdu_handler_parse_data_element_sequence
           (
               /* INOUT */  UCHAR**      /* pdu */,
               /* INOUT */  UINT16*      /* length */,
               /* OUT */    void*       /* data */,
               /* OUT */    UCHAR*       /* type */,
               /* INOUT */  UINT16*      /* num_of_elements */
           );

API_RESULT sdp_pdu_handler_frame_data_element_header
           (
               /* IN */     UCHAR        /* type */,
               /* IN */     UINT32       /* length */,
               /* INOUT */  SDP_PDU*      /* pdu */
           );


/* --------- SDP Server Request Handler */
API_RESULT sdp_server_request_handler
           (
               /* IN */    SDP_CE*      /* entity */,
               /* IN */    UCHAR*       /* data */,
               /* IN */    UINT16       /* datalen */
           );

API_RESULT sdp_server_response_handler
           (
               /* INOUT */ SDP_CE*   /* Entity */,
               /* INOUT */ UCHAR*       /* param */,
               /* IN */    UINT16       /* param_length */
           );

API_RESULT sdp_server_get_record_handles
           (
               /* INOUT */ UCHAR**      /* param */,
               /* INOUT */ UCHAR*       /* cont_state_info */,
               /* INOUT */ UINT16*      /* length */,
               /* OUT */   UINT32**     /* alloc_record_handle_array */,
               /* OUT */   UINT32**     /* record_handle */,
               /* INOUT */ UINT16*      /* num_record_handle */
           );

API_RESULT sdp_server_frame_attribute_list
           (
               /* INOUT */ SDP_CE*   /* transaction */,
               /* IN */    UCHAR*       /* data */,
               /* IN */    UINT16       /* data_len */,
               /* IN */    UINT32*      /* handle */,
               /* IN */    UCHAR        /* num_handle */
           );

API_RESULT sdp_server_get_attr_values
           (
               /* IN */    UCHAR*       /* data */,
               /* IN */    UINT16       /* data_len */,
               /* IN */    UINT32       /* record */,
               /* INOUT */ UCHAR*       /* cont_state_info */,
               /* OUT */   UCHAR*       /* rsp */,
               /* INOUT */ UINT32*      /* ds_len */
           );


#ifdef SDP_CLIENT
/* -------- SDP Client Handler */
API_RESULT sdp_api_req_handler
           (
               /* IN */    SDP_HANDLE*  /* bd_addr */,
               /* IN */    UCHAR        /* operation */,
               /* IN */    void*        /* params */,
               /* IN */    UINT16       /* params_len */,
               /* IN */    UINT32       /* continuation */,
               /* OUT */   void*        /* out_params */,
               /* OUT */   UINT16*      /*out_param_len*/
           );

API_RESULT sdp_client_response_handler
           (
               /* IN */  SDP_CE*           /* entity */,
               /* IN */  SDP_USER_CONTEXT* /* context */,
               /* IN */  UCHAR*            /* data */,
               /* IN */  UINT16            /* datalen */
           );

API_RESULT sdp_client_frame_attribute_list
           (
               /* IN */    UINT16*        /* attr_ids */,
               /* IN */    UINT16         /* num_attr_ids */,
               /* IN */    UINT32*        /* attr_id_range */,
               /* IN */    UINT16         /* num_attr_id_range */,
               /* INOUT */ SDP_PDU*       /* pdu */
           );

API_RESULT sdp_client_context_find
           (
               /* IN */    DEVICE_HANDLE    *    /* Device Context */,
               /* OUT */   SDP_USER_CONTEXT **   /* context */
           );

void sdp_context_signal
     (
         /* IN */  SDP_USER_CONTEXT *,
         /* IN */  API_RESULT
     );

API_RESULT sdp_client_request_handler
           (
                  /* IN */    SDP_USER_CONTEXT*   /* context */,
                  /* IN */    void*               /* params */
           );


/* --------- SDP Client Utility Functions */
API_RESULT sdp_search_attribute_value
           (
               /* INOUT */ UCHAR**        /* read_buff */,
               /* INOUT */ UINT16*        /* length */,
               /* IN */    UINT16         /* attr_id_requested */
           );

API_RESULT sdp_get_psm
           (
               /* IN */    UCHAR*         /* data */,
               /* IN */    UINT16         /* length */,
               /* OUT */   UINT16*        /* psm */,
               /* IN */    UCHAR          /* psm index */
           );

API_RESULT sdp_get_UINT32_attribute_value
           (
               /* IN */    UCHAR*         /* attribute_data */,
               /* IN */    UINT16         /* id */,
               /* OUT */   UINT32*        /* value */
           );

API_RESULT sdp_get_UUID_attribute_value
           (
               /* IN */    UCHAR*         /* attribute_data */,
               /* IN */    UINT16         /* id */,
               /* OUT */   S_UUID*        /* uuid_list */,
               /* INOUT */ UINT16*        /* uuid_list_length */
           );

API_RESULT sdp_get_PointerToUUID
           (
               /* INOUT */ UCHAR**        /* data */,
               /* INOUT */ UINT16*        /* length */,
               /* IN */    UINT16         /* byte2_uuid */
           );

API_RESULT sdp_get_channel
           (
               /* IN */    UCHAR*         /* data */,
               /* IN */    UINT16         /* length */,
               /* OUT */   UCHAR*         /* channel */
           );

API_RESULT sdp_get_int_attribute_value
           (
               /* IN */    UCHAR*         /* attribute_data */,
               /* IN */    UINT16         /* id */,
               /* OUT */   UCHAR*         /* value */,
               /* IN */    UCHAR          /* val_len */
           );

API_RESULT sdp_get_string_attribute_value
           (
               /* IN */    UCHAR*         /* attribute_data */,
               /* IN */    UINT16         /* id */,
               /* OUT */   UCHAR*         /* string */,
               /* IN */    UINT16         /* str_length */
           );

API_RESULT sdp_get_handle_range
           (
               /* IN */  UCHAR *     data,
               /* IN */  UINT16      length,
               /* OUT */ UINT16 *    start_handle,
               /* OUT */ UINT16 *    end_handle
           );

#endif /* SDP_CLIENT */


#endif /* _H_SDP_INTERNAL_ */


